﻿<UserControl x:Class="XERP.Client.WPF.LogIn.Views.LogInView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
             xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
            d:DesignHeight="200" d:DesignWidth="300" KeyUp="UserControl_KeyUp">
    <Grid Loaded="Grid_Loaded">
        <Grid.RowDefinitions>
            <RowDefinition Height="50"></RowDefinition>
            <RowDefinition Height="200*"></RowDefinition>
            <RowDefinition Height="50"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="150*"></ColumnDefinition>
            <ColumnDefinition Width="250*"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <TextBlock Text="XERP Log In" Grid.Row="0" Grid.ColumnSpan="2" 
                   HorizontalAlignment="Center" Margin="4" FontWeight="Bold"
                   FontSize="20">
        </TextBlock>
        <StackPanel VerticalAlignment="Center" Grid.Row="1" Grid.Column="0"
                    HorizontalAlignment="Right" >
            <TextBlock Margin="5,5,5,5" FontWeight="Bold" 
                       FontStyle="Italic" FontSize="18" 
                       HorizontalAlignment="Right">User:
            </TextBlock>
            <TextBlock Margin="5,5,5,5" FontWeight="Bold" 
                       FontStyle="Italic" FontSize="18" 
                       HorizontalAlignment="Right">Password:
            </TextBlock>
            <TextBlock Margin="5,5,5,5" FontWeight="Bold" 
                       FontStyle="Italic" FontSize="18" 
                       HorizontalAlignment="Right">Company:
            </TextBlock>
        </StackPanel>
        <StackPanel VerticalAlignment="Center" Grid.Row="1" Grid.Column="1"
                    HorizontalAlignment="Stretch" >
            <TextBox Name="txtKey" Margin="5,5,5,5" FontSize="14"
                     Text="{Binding Path=UserNameInput}"
                     MaxLength= "{Binding CompanyMaxFieldValueDictionary[SystemUserID]}">
                
            </TextBox>
            <TextBox Margin="5,5,5,5" FontSize="14"
                     Text="{Binding Path=PasswordInput}" 
                     MaxLength= "{Binding CompanyMaxFieldValueDictionary[Password]}" >
            </TextBox>
            <ComboBox  HorizontalAlignment="Stretch"  Margin="5"
                            ItemsSource="{Binding Path=GlobalCompanyList}"
                            DisplayMemberPath="CompanyID"
                            SelectedValue="{Binding Path=GlobalCompanyID, Mode=TwoWay}"
                            SelectedValuePath="CompanyID" Height="23">
            </ComboBox>
            <TextBox Width="0" Height="0"  Name="ghost" KeyboardNavigation.IsTabStop="False"/>
        </StackPanel>
        <StackPanel Orientation="Horizontal" Grid.Row="2"  Grid.Column="2"
                    VerticalAlignment="Center" HorizontalAlignment="Left">
          <Button Content="OK" Width="40" Margin="20,4,25,4" FontSize="15">
            <i:Interaction.Triggers>
              <i:EventTrigger EventName="Click">
                <ei:CallMethodAction
                        TargetObject="{Binding}"
                        MethodName="AuthenticateCommand"/>
              </i:EventTrigger>
            </i:Interaction.Triggers>
          </Button>
            <Button Content="Cancel" Margin="4,4,4,4" Click="Cancel_Click" FontSize="15"></Button>
        </StackPanel>
    </Grid>
</UserControl>
